<template>
  <div class="userNoteItem">
    <div class="left">
      <div class="month">{{ item.month_text }}</div>
      <div class="day">{{ item.day_text }}</div>
    </div>
    <div
      v-if="item.day_list[0]"
      class="right"
      :style="{ backgroundImage: `url(${item.day_list[0].images[0].u})` }"
      @click="toNote(item.day_list[0])"
    >
      <div class="more" v-if="item.day_list[0].images.length > 1">
        <van-icon name="photo" size="14" color="white" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import router from "@/router";

const props = defineProps(["item"]);

const toNote = (obj) => {
  // console.log("toNote");
  router.push({
    path: "/noteDetail",
    query: { id: obj.id, user_id: obj.author.id },
  });
};
</script>

<style lang="scss" scoped>
.userNoteItem {
  display: flex;
  margin-bottom: 5px;

  .left {
    width: 50px;
    display: flex;
    flex-direction: column;
    // margin-right: 20px;

    .month {
      font-size: 14px;
      margin-bottom: 8px;
    }

    .day {
      font-size: 20px;
      font-weight: bold;
    }
  }

  .right {
    width: 95px;
    height: 95px;
    border-radius: 10px;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: 100%;
    position: relative;
    cursor: pointer;

    .more {
      position: absolute;
      bottom: 5px;
      right: 5px;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background-color: rgba(0, 0, 0, 0.3);
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
}
</style>
